//
//  QTTPublicOneBtnAlertView.m
//  QuTouTiao
//
//  Created by 杨杨子 on 2018/6/24.
//  Copyright © 2018年 杨杨子. All rights reserved.
//

#import "QTTPublicOneBtnAlertView.h"
@interface QTTPublicOneBtnAlertView()
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet UILabel *tittleLb;
@property (weak, nonatomic) IBOutlet UIButton *Btn;
- (IBAction)BtnAction:(id)sender;
@property (nonatomic,strong) ActionBlock btnBlock;

@end
@implementation QTTPublicOneBtnAlertView
-(void)awakeFromNibAndTittle:(NSString *)tittle AndBtnStr:(NSString *)Str AndBlock:(ActionBlock)block AndFatherView:(UIView *)fatherView{
    [super awakeFromNib];
    self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    self.backView.layer.borderWidth = 1.0;
    self.backView.backgroundColor = [UIColor whiteColor];
    self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.2];
    self.tittleLb.text = tittle;
    [self.Btn setTitle:Str forState:UIControlStateNormal];
//    self.Btn.layer.cornerRadius = 10;
//    self.Btn.layer.masksToBounds = YES;
//    self.Btn.layer.borderWidth = 1.0;
//    self.Btn.layer.borderColor = [UIColor blackColor].CGColor;
    [self.Btn setCornerRadius:10.0 AndBorderColor:[UIColor blackColor] AndBorderWidth:1.0];
    self.btnBlock = block;
    [fatherView addSubview:self];
}
- (IBAction)BtnAction:(id)sender{
    [self removeFromSuperview];
    if (self.btnBlock) {
        self.btnBlock();
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
